package com.google.gwt.it2tool.server;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.gwt.it2tool.client.ProductionPrototype;

@PersistenceCapable
public class ProductionPrototypeJDO implements Serializable {
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private String name;
	@Persistent
	private double productivity;
	@Persistent
	private double duration;
	
	public ProductionPrototypeJDO(){
	}
	
	public ProductionPrototypeJDO(String name, double productivity, double duration) {
		this.name = name;
		this.duration = duration;
		this.productivity = productivity;
	}
	
	public ProductionPrototypeJDO(ProductionPrototype proto) {
		set(proto);
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getProductivity() {
		return productivity;
	}

	public void setProductivity(double productivity) {
		this.productivity = productivity;
	}

	public double getDuration() {
		return duration;
	}

	public void setDuration(double duration) {
		this.duration = duration;
	}
	
	public void set(ProductionPrototype proto){
		name = proto.getName();
		duration = proto.getDuration();
		productivity = proto.getProductivity();
	}
	
	
}
